I've seen scripts use the undocumented function probeAttr_().
Anyone now more about what it does?
The one use I am looking at now is as follows for the Module m:
string s=probeAttr(m,"my_module_attribute")
Why not just do the following, which works:
string s=m."my_module_attribute"
Regards,
Strathglass
strathglass - Thu Jul 30 11:03:04 EDT 2009 |
|
Re: probeAttr_() purpose? SystemAdmin - Thu Jul 30 11:28:34 EDT 2009
Look in lib/dxl/utils/attrutil.inc, probeAttr_ is defined there.
Actually there are many different versions of this function, but the basic functionality is to check that the named attribute exists and can be read which the s=m."my_module_attribute" does not do.
|
|
Re: probeAttr_() purpose? strathglass - Thu Jul 30 11:37:49 EDT 2009 SystemAdmin - Thu Jul 30 11:28:34 EDT 2009
Look in lib/dxl/utils/attrutil.inc, probeAttr_ is defined there.
Actually there are many different versions of this function, but the basic functionality is to check that the named attribute exists and can be read which the s=m."my_module_attribute" does not do.
Ahhh, I see. Thanks Pekka!
(I'll have to check in the utility functions next time I see an undocumented DOORS function.)
Regards, Strathglass.
|
|
Re: probeAttr_() purpose? llandale - Thu Jul 30 14:25:58 EDT 2009
... and that the attr is appropriate for Module/Object, and always returns. s = m."Prefixxxxx" aborts with DXL errors.
|
|
Re: probeAttr_() purpose? strathglass - Thu Jul 30 15:26:54 EDT 2009 llandale - Thu Jul 30 14:25:58 EDT 2009
... and that the attr is appropriate for Module/Object, and always returns. s = m."Prefixxxxx" aborts with DXL errors.
Louie - agreed.
I just didn't realize probeAttr_() wrapped up a lot of needed functionality for you like that.
Normally before I assign string s some (e.g object) attribute value "MyAttr" I would of course do:
AttrDef ad=find(current Module,"MyAttr")
if (! null ad) //...handle case where attribute exist
Object o=current
string s=(current Object)."MyAttr"
else //...handle non-existant case
Regards, Strathglass
|
|
Re: probeAttr_() purpose? llandale - Thu Jul 30 17:04:15 EDT 2009 strathglass - Thu Jul 30 15:26:54 EDT 2009
Louie - agreed.
I just didn't realize probeAttr_() wrapped up a lot of needed functionality for you like that.
Normally before I assign string s some (e.g object) attribute value "MyAttr" I would of course do:
AttrDef ad=find(current Module,"MyAttr")
if (! null ad) //...handle case where attribute exist
Object o=current
string s=(current Object)."MyAttr"
else //...handle non-existant case
Regards, Strathglass
I think you mean:
if (!null ad and canReadVal(ad) and ad.object and canRead(o."MyAttr"))...
Yup, we <Disallowed content detected, rhymes with 'Drainal Attentive'> folks can come up with lots of ways something can fail.
|
|
Re: probeAttr_() purpose? strathglass - Fri Jul 31 07:51:56 EDT 2009 llandale - Thu Jul 30 17:04:15 EDT 2009
I think you mean:
if (!null ad and canReadVal(ad) and ad.object and canRead(o."MyAttr"))...
Yup, we <Disallowed content detected, rhymes with 'Drainal Attentive'> folks can come up with lots of ways something can fail.
Well Louie you did a better job finding failure methods than I did.
Actually you've pointed out some good tips there, thanks.
However I didn't see any canReadVal() function in DOORS 8.1 (maybe that's a 9.x thing???).
Regards, Strathglass.
|
|
Re: probeAttr_() purpose? llandale - Fri Jul 31 10:54:06 EDT 2009 strathglass - Fri Jul 31 07:51:56 EDT 2009
Well Louie you did a better job finding failure methods than I did.
Actually you've pointed out some good tips there, thanks.
However I didn't see any canReadVal() function in DOORS 8.1 (maybe that's a 9.x thing???).
Regards, Strathglass.
canReadVal(AttrDef) and canReadDef(AttrDef) are in the v8.3 and v9.1 doors.exe. Yes, not in the manual.
There may be some failures that I find, but generally they go out of their way to find me. It may be a Karma thing, but more likely its a Spider conspiracy as part of their life-long jihad to torment me. lol
|
|
Re: probeAttr_() purpose? Strad - Wed Aug 26 10:10:48 EDT 2009
I was told a while ago that there are downsides to probeAttr though, from what I recall over using it will load your string table like mad as it re-instances the input string several times....
|
|